home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 110
/
EnigmaAmiga110CD.iso
/
dalla rivista
/
host contacted
/
wbstartup+.lha
/
WBStartup+
/
Source
/
WBStartup+OS3.5
/
ReadKeyboard.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-02-28
|
4KB
|
142 lines
#include <exec/types.h>
#include <exec/ports.h>
#include <exec/io.h>
#include <proto/exec.h>
#include <devices/keyboard.h>
#include <devices/inputevent.h>
#include <devices/input.h>
#include "ReadKeyboard.h"
#include "WBStartup+.h"
#include <proto/input.h>
#include <clib/input_protos.h>
#include <clib/alib_protos.h>
#include <stdio.h>
#include <string.h>
#include <clib/utility_protos.h>
extern struct Device *InputBase;
//extern struct Library *UtilityBase;
/*
BOOL IsQualifierDepressed(struct WBStartupPrefs *prefs)
{
struct MsgPort *InputMP;
struct IOStdReq *InputIO;
UBYTE matrix[13];
// ULONG inputsigflag;
BOOL success=FALSE;
BOOL runprefs=FALSE;
/////////////////////////
// Set up input device //
/////////////////////////
if (InputMP=CreateMsgPort())
{
if (InputIO = CreateIORequest (InputMP, sizeof (struct IOStdReq)))
{
if ( !(OpenDevice("keyboard.device",0,(struct IORequest *) InputIO,0)) )
{
//inputsigflag = 1L << InputMP->mp_SigBit;
InputIO->io_Length = 13;
InputIO->io_Command = KBD_READMATRIX;
InputIO->io_Data = matrix;
DoIO ((struct IORequest *) InputIO);
if((matrix[96/8] & (1<<(96%8)))) // 96 (is the Raw Key number for Left Shift, p. 831 RKM
success=TRUE;
else if((matrix[99/8] & (1<<(99%8)))) // 99 is the Raw Key number for Ctrl
runprefs=TRUE;
else if((matrix[100/8] & (1<<(100%8)))) // 100 is the Raw Key number for Left Alt
prefs->Interactive = TRUE;
CloseDevice ((struct IORequest *) InputIO);
}
DeleteIORequest(InputIO);
}
DeleteMsgPort(InputMP);
}
if (runprefs)
RunPrefs(prefs);
return(success);
}
*/
//NEW
BOOL IsQualifierDepressed (struct WBStartupPrefs *prefs)
{
struct IORequest *InputIO;
struct MsgPort *InputMP;
BOOL success = FALSE;
BOOL runprefs = FALSE;
/////////////////////////
// Set up input device //
/////////////////////////
if (InputMP = CreatePort (NULL, 0))
{
if (InputIO = CreateExtIO (InputMP, sizeof (struct IOStdReq)))
{
if (!OpenDevice ("input.device", 0, (struct IORequest *) InputIO, 0))
{
UWORD data;
//char buffer [6];
InputBase = (struct Device *) InputIO -> io_Device;
data = PeekQualifier();
/*
sprintf (buffer, "%x", data);
ShowRequester (buffer);
// check user input
ShowRequester (prefs -> RunPrefsQual);
ShowRequester (prefs -> DisableQual);
ShowRequester (prefs -> InteractiveQual);
*/
if (data & (GetQualName (prefs -> RunPrefsQual)))
{
runprefs = TRUE;
}
else if (data & (GetQualName (prefs -> DisableQual)))
{
success = TRUE;
}
else if (data & (GetQualName (prefs -> InteractiveQual)))
{
prefs -> Interactive = TRUE;
}
CloseDevice ((struct IORequest *) InputIO);
}
else
ShowRequester ("failed to open input device");
DeleteIORequest (InputIO);
}
else
ShowRequester ("Failed to create IORequest");
DeleteMsgPort (InputMP);
}
else
ShowRequester ("failed to create msg port");
if (runprefs)
RunPrefs (prefs);
return(success);
}